<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>鼠标事件</title>
	</head>
	<body>
		<button>mousedown -> mouseup -> click</button>

		<script>
			const btn = document.querySelector('button')

			// 鼠标按下
			btn.addEventListener('mousedown', function (e) {
				console.log(e.button) // 0 鼠标左键 1 鼠标中键 2 鼠标右键 x1 后退按键 x2 前进按键
				console.log('mousedown')
			})

			// 鼠标抬起
			btn.addEventListener('mouseup', function (e) {
				console.log('mouseup')
			})

			// 鼠标点击
			btn.addEventListener('click', function (e) {
				console.log('click')
			})
		</script>
	</body>
</html>
